let template = `
<body>
   hello <%=name%>
   hello <%=age%>
</body>
`;
function render(template,locals){
    return template.replace(/<%=(\w+)%>/g,(_,key)=>{
        return locals[key];
    });
}
let result = render(template,{name:'zhangsan',age:18});
console.log(result)